<?php

class Adept_Util_String 
{

    static public function toUnderScoresNotation($source)
    {
        return ltrim(preg_replace('~([a-z])?([A-Z])([a-z])~e', "'\\1_'.strtolower('\\2').'\\3'", $source), '_');
    }

    static public function toCamelNotation($source, $upperFirstLetter = false)
    {
        $res = preg_replace('~([a-zA-Z])?_([a-zA-Z])~e',
                            "'\\1'.strtoupper('\\2')",
                            $source);
        return ($upperFirstLetter) ? ucfirst($res) : $res;
    }

}